package snake.ui;

import snake.common.Constant;
import snake.common.GameContextHolder;

import javax.swing.*;
import java.awt.*;

public class GameFrame extends JFrame {

    public GameFrame() throws HeadlessException {
        this.setTitle(Constant.DEFAULT_WINDOW_TITLE);
        this.setSize(Constant.DEFAULT_WINDOW_WIDTH, Constant.DEFAULT_WINDOW_HEIGHT);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setResizable(false);
        this.setVisible(true);

        this.setLayout(new BorderLayout());
        this.add(new GamePanel(),BorderLayout.CENTER);

    }


    public void start() {
       GameContextHolder.getContext().getTimer().start();
    }
}
